package jin.si.com.web;

import java.io.Serializable;

/**
 * @description:
 * @ClassName Person
 * @Author MT
 * @Date 2021/7/4 9:30
 **/
public class Person implements Comparable, Serializable {


    private int age;
    private String name;

    public Person(int age,String name) {
        this.age=age;
        this.name=name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    @Override
    public int compareTo(Object o) {
        Person p= (Person) o;
        int result=0;
        result=this.age-p.getAge();
        if(result==0){
            result=this.name.compareTo(p.getName());
        }

        return result;
    }



}
